<style>
    #subjectCategory-update {
        padding: 20px 25px 25px 0;
    }
</style>
<div class="layui-fluid" id="subjectCategory-update">
    <form class="layui-form" action="" lay-filter="subjectCategory-update-form">
        <div class="layui-form-item febs-hide">
            <label class="layui-form-label febs-form-item-require">学科类别id：</label>
            <div class="layui-input-block">
                <input type="text" name="id" data-th-value="${subjectCategory.id}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label febs-form-item-require">类别名称：</label>
            <div class="layui-input-block">
                <input type="text" name="fullName" minlength="2" maxlength="20"
                       lay-verify="range|name" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label febs-form-item-require">简称：</label>
            <div class="layui-input-block">
                <input type="text" name="simpleName" minlength="2" maxlength="20"
                       lay-verify="range|name" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">备注：</label>
            <div class="layui-input-block">
                <textarea name="remark" maxlength="200" class="layui-textarea">
                </textarea>
            </div>
        </div>
        <div class="layui-form-item febs-hide">
            <button class="layui-btn" lay-submit="" lay-filter="subjectCategory-update-form-submit" id="submit"></button>
        </div>
    </form>
</div>

<script data-th-inline="javascript">
    layui.use(['febs', 'form', 'validate'], function () {
        let $ = layui.$,
            febs = layui.febs,
            layer = layui.layer,
            form = layui.form,
            subjectCategory = [[${subjectCategory}]],
            validate = layui.validate;

        form.verify(validate);
        form.render();

        initCollegeValue();

        function initCollegeValue() {
            form.val("subjectCategory-update-form", {
                "fullName": subjectCategory.fullName,
                "simpleName": subjectCategory.simpleName,
                "remark": subjectCategory.remark
            });
        }

        form.on('submit(subjectCategory-update-form-submit)', function (data) {
            if (febs.nativeEqual(data.field, subjectCategory)) {
                febs.alert.warn('数据未作任何修改！');
                return false;
            }
            febs.post(ctx + 'subjectCategory/update', data.field, function () {
                layer.closeAll();
                febs.alert.success(subjectCategory.id + ' 院校类别数据修改成功');
                $('#businesses-subjectCategory').find('#query').click();
            });
            return false;
        });
    });
</script>